
// 选中主表某行的逻辑


export default function handleTableSelect(props, moduleId, record, index) {
    const {editTable, button} = this.props;
    const {currentSelectDepartment, disabledTreeNodeList} = this.state;

    let selectedData = editTable.getCheckedRows('ncc60071025list');
    let currentDisable = disabledTreeNodeList.includes(currentSelectDepartment);

    // 只有在有选中项的时候，才可以点击批量添加子集
    if(selectedData.length > 0) {
        this.setButtonStatus2('hasSelectedRow');
    }
    else {
        this.setButtonStatus2('mainTableHasData');
    }
    // 注释部分是去掉历史数据逻辑
    let notHis = [];
    let withHis = [];

    selectedData.map((item, index) => {
        if(!item.data.values['pk_psndoc.ishiskeypsn'].value) {
            notHis.push(item);
        }
        withHis.push(item);
    });
    this.props.button.setButtonDisabled({
        refadd: !currentSelectDepartment || currentDisable,
        BatchEdit: currentDisable
    });

    this.setState({
        selectedRows: selectedData,
        // selectedRows: notHis,
        selectedRowsWithHis: withHis,
        handleTableSelect: selectedData
    });
}
